package kz.kstu.scantest.desktop.api;

import javax.swing.filechooser.FileFilter;
import java.io.File;

/**
 * @author Filipp_Stankevich
 *         created 02.09.12 21:16
 */
public class KeyFileFilter extends FileFilter {

    private static final String KEY_FLE_EXTENSION = ".crt";

    private static final String FILE_MESSAGE = "Файлы ключей (*.crt)";

    @Override
    public boolean accept(File f) {
        String path = f.getPath();

        return f.isDirectory() || path.endsWith(KEY_FLE_EXTENSION)
                || path.endsWith(KEY_FLE_EXTENSION.toUpperCase()) ;
    }

    @Override
    public String getDescription() {
        return FILE_MESSAGE;
    }
}
